package erfgame.core.entity;

import erfgame.core.Dimensions3D;
import erfgame.core.Point3D;

public abstract class AbstractPhysicalEntity 
	extends AbstractEntity 
	implements Physical {

	private static final long serialVersionUID = 0;

	private Dimensions3D dimensions;
	private Point3D position;
	
	public AbstractPhysicalEntity( long id, EntityType entityType ) {
		super(id, entityType);
	}
	
	public Dimensions3D getDimensions() {
		return dimensions;
	}
	
	public void setDimensions( Dimensions3D dimensions ) {
		this.dimensions = dimensions;
	}

	public Point3D getPosition() {
		return position;
	}

	public void setPosition( Point3D position ) {
		Point3D oldPosition = this.position;
		if( !position.equals( oldPosition ) ) {
			this.position = position;
			this.fireEntityChangeEvent( 
					new EntityChangeEvent<Point3D>(
							EntityEventType.position, 
							oldPosition, 
							position 
					) 
			);
		}
	}
}
